home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Strate…Tools for the Enterprise / Microsoft Internet Strategy & Tools for the Enterprise.iso / content / devel.tls / icp / vbsamp / newsexpl.exe / FRMNEWS.FRM (.txt) next >
Visual Basic Form  |  1996-03-22  |  29KB  |  721 lines

  1. VERSION 4.00
  2. Begin VB.Form frmNews 
  3.    Caption         =   "Internet News Explorer"
  4.    ClientHeight    =   6225
  5.    ClientLeft      =   690
  6.    ClientTop       =   1800
  7.    ClientWidth     =   10560
  8.    Height          =   6915
  9.    Icon            =   "frmNews.frx":0000
  10.    Left            =   630
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    ScaleHeight     =   6225
  14.    ScaleWidth      =   10560
  15.    Top             =   1170
  16.    Width           =   10680
  17.    Begin VB.PictureBox vSizeBar 
  18.       BorderStyle     =   0  'None
  19.       Height          =   25
  20.       Left            =   2550
  21.       MousePointer    =   7  'Size N S
  22.       ScaleHeight     =   30
  23.       ScaleWidth      =   7995
  24.       TabIndex        =   6
  25.       Top             =   2340
  26.       Width           =   7995
  27.    End
  28.    Begin VB.PictureBox SizeBar 
  29.       BorderStyle     =   0  'None
  30.       Height          =   5445
  31.       Left            =   2520
  32.       MousePointer    =   9  'Size W E
  33.       ScaleHeight     =   5445
  34.       ScaleWidth      =   30
  35.       TabIndex        =   3
  36.       Top             =   390
  37.       Width           =   25
  38.    End
  39.    Begin VB.Timer NRStatus 
  40.       Left            =   10650
  41.       Top             =   4590
  42.    End
  43.    Begin NNTPCTLib.nntpct NNTPCT 
  44.       Left            =   10620
  45.       Top             =   5100
  46.       _ExtentX        =   847
  47.       _ExtentY        =   847
  48.       RemoteHost      =   ""
  49.       RemotePort      =   119
  50.       ConnectTimeout  =   0
  51.       RecvTimeout     =   0
  52.       NotificationMode=   1
  53.       LastUpdate      =   824518319
  54.    End
  55.    Begin MSComDlg.CommonDialog ComDLG 
  56.       Left            =   10590
  57.       Top             =   2910
  58.       _Version        =   65536
  59.       _ExtentX        =   847
  60.       _ExtentY        =   847
  61.       _StockProps     =   0
  62.    End
  63.    Begin ComctlLib.StatusBar Status 
  64.       Align           =   2  'Align Bottom
  65.       Height          =   345
  66.       Left            =   0
  67.       TabIndex        =   1
  68.       Top             =   5880
  69.       Width           =   10560
  70.       _Version        =   65536
  71.       _ExtentX        =   18627
  72.       _ExtentY        =   609
  73.       _StockProps     =   68
  74.       AlignSet        =   -1  'True
  75.       SimpleText      =   ""
  76.       _timers         =   3
  77.       NumPanels       =   4
  78.       i1              =   "frmNews.frx":030A
  79.       i2              =   "frmNews.frx":0416
  80.       i3              =   "frmNews.frx":0543
  81.       i4              =   "frmNews.frx":0697
  82.    End
  83.    Begin VB.Label lblNewsGroup 
  84.       BorderStyle     =   1  'Fixed Single
  85.       Height          =   255
  86.       Left            =   2550
  87.       TabIndex        =   5
  88.       Top             =   390
  89.       Width           =   7995
  90.    End
  91.    Begin ComctlLib.ImageList TBImages 
  92.       Left            =   10620
  93.       Top             =   3390
  94.       _Version        =   65536
  95.       _ExtentX        =   1005
  96.       _ExtentY        =   1005
  97.       _StockProps     =   1
  98.       BackColor       =   -2147483643
  99.       ImageWidth      =   16
  100.       ImageHeight     =   16
  101.       MaskColor       =   12632256
  102.       NumImages       =   11
  103.       i1              =   "frmNews.frx":07E7
  104.       i2              =   "frmNews.frx":09E6
  105.       i3              =   "frmNews.frx":0BE5
  106.       i4              =   "frmNews.frx":0DE4
  107.       i5              =   "frmNews.frx":0FE3
  108.       i6              =   "frmNews.frx":11E2
  109.       i7              =   "frmNews.frx":15A1
  110.       i8              =   "frmNews.frx":1960
  111.       i9              =   "frmNews.frx":1B5F
  112.       i10             =   "frmNews.frx":1F1E
  113.       i11             =   "frmNews.frx":22DE
  114.    End
  115.    Begin ComctlLib.ListView ListMSG 
  116.       Height          =   1695
  117.       Left            =   2550
  118.       TabIndex        =   4
  119.       Top             =   660
  120.       Width           =   7995
  121.       _Version        =   65536
  122.       _ExtentX        =   14102
  123.       _ExtentY        =   2990
  124.       _StockProps     =   205
  125.       ForeColor       =   -2147483640
  126.       BackColor       =   -2147483643
  127.       Appearance      =   1
  128.       BorderStyle     =   1
  129.       Arrange         =   2
  130.       HideSelection   =   0   'False
  131.       Icons           =   "Images"
  132.       LabelEdit       =   1
  133.       LabelWrap       =   0   'False
  134.       SmallIcons      =   "Images"
  135.       View            =   3
  136.       NumItems        =   3
  137.       i1              =   "frmNews.frx":27D6
  138.       i2              =   "frmNews.frx":2880
  139.       i3              =   "frmNews.frx":292A
  140.    End
  141.    Begin ComctlLib.Toolbar Tools 
  142.       Align           =   1  'Align Top
  143.       Height          =   390
  144.       Left            =   0
  145.       TabIndex        =   2
  146.       Top             =   0
  147.       Width           =   10560
  148.       _Version        =   65536
  149.       _ExtentX        =   18627
  150.       _ExtentY        =   688
  151.       _StockProps     =   96
  152.       ImageList       =   "TBImages"
  153.       NumButtons      =   12
  154.       i1              =   "frmNews.frx":29D4
  155.       i2              =   "frmNews.frx":2B73
  156.       i3              =   "frmNews.frx":2D2E
  157.       i4              =   "frmNews.frx":2F0D
  158.       i5              =   "frmNews.frx":30DC
  159.       i6              =   "frmNews.frx":327B
  160.       i7              =   "frmNews.frx":3452
  161.       i8              =   "frmNews.frx":362D
  162.       i9              =   "frmNews.frx":3804
  163.       i10             =   "frmNews.frx":39A3
  164.       i11             =   "frmNews.frx":3B7B
  165.       i12             =   "frmNews.frx":3D53
  166.       AlignSet        =   -1  'True
  167.    End
  168.    Begin ComctlLib.ImageList Images 
  169.       Left            =   10620
  170.       Top             =   3990
  171.       _Version        =   65536
  172.       _ExtentX        =   1005
  173.       _ExtentY        =   1005
  174.       _StockProps     =   1
  175.       BackColor       =   -2147483643
  176.       ImageWidth      =   16
  177.       ImageHeight     =   16
  178.       NumImages       =   5
  179.       i1              =   "frmNews.frx":3F2B
  180.       i2              =   "frmNews.frx":4422
  181.       i3              =   "frmNews.frx":47E1
  182.       i4              =   "frmNews.frx":4BA0
  183.       i5              =   "frmNews.frx":4F5F
  184.    End
  185.    Begin ComctlLib.TreeView Tree 
  186.       Height          =   5505
  187.       Left            =   0
  188.       TabIndex        =   0
  189.       Top             =   390
  190.       Width           =   2535
  191.       _Version        =   65536
  192.       _ExtentX        =   4471
  193.       _ExtentY        =   9710
  194.       _StockProps     =   196
  195.       Enabled         =   0   'False
  196.       Appearance      =   1
  197.       BorderStyle     =   1
  198.       HideSelection   =   0   'False
  199.       ImageList       =   "Images"
  200.       Indentation     =   441
  201.       LabelEdit       =   1
  202.       PathSeparator   =   "."
  203.       Sorted          =   -1  'True
  204.       Style           =   7
  205.    End
  206.    Begin RichtextLib.RichTextBox txtMSG 
  207.       Height          =   3465
  208.       Left            =   2550
  209.       TabIndex        =   7
  210.       Top             =   2370
  211.       Width           =   7965
  212.       _Version        =   65536
  213.       _ExtentX        =   14049
  214.       _ExtentY        =   6112
  215.       _StockProps     =   69
  216.       BackColor       =   -2147483643
  217.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  218.          name            =   "Courier New"
  219.          charset         =   0
  220.          weight          =   400
  221.          size            =   8.25
  222.          underline       =   0   'False
  223.          italic          =   0   'False
  224.          strikethrough   =   0   'False
  225.       EndProperty
  226.       ScrollBars      =   3
  227.       TextRTF         =   $"frmNews.frx":531E
  228.    End
  229.    Begin VB.Menu mFile 
  230.       Caption         =   "&File"
  231.       Begin VB.Menu mConnect 
  232.          Caption         =   "&Connect To News Server..."
  233.       End
  234.       Begin VB.Menu mDisconnect 
  235.          Caption         =   "&Disconnect"
  236.       End
  237.       Begin VB.Menu m_1 
  238.          Caption         =   "-"
  239.       End
  240.       Begin VB.Menu mCancel 
  241.          Caption         =   "Cancel Transaction"
  242.       End
  243.       Begin VB.Menu m_4 
  244.          Caption         =   "-"
  245.       End
  246.       Begin VB.Menu mExit 
  247.          Caption         =   "&Exit"
  248.       End
  249.    End
  250.    Begin VB.Menu mTools 
  251.       Caption         =   "&Tools"
  252.       Begin VB.Menu mPost 
  253.          Caption         =   "&Post Message..."
  254.       End
  255.       Begin VB.Menu mReply 
  256.          Caption         =   "&Reply To Message..."
  257.       End
  258.       Begin VB.Menu m_2 
  259.          Caption         =   "-"
  260.       End
  261.       Begin VB.Menu mDecodeMsg 
  262.          Caption         =   "&UU Decode Message"
  263.       End
  264.       Begin VB.Menu mDecodeMultMsg 
  265.          Caption         =   "UU &Decode Multiple Messages..."
  266.          Enabled         =   0   'False
  267.       End
  268.    End
  269.    Begin VB.Menu mNewsGroup 
  270.       Caption         =   "&News Group"
  271.       Begin VB.Menu mRefresh 
  272.          Caption         =   "&Refresh Newsgroup Database"
  273.       End
  274.       Begin VB.Menu m_3 
  275.          Caption         =   "-"
  276.       End
  277.       Begin VB.Menu mSubscribe 
  278.          Caption         =   "&Subscribe"
  279.       End
  280.       Begin VB.Menu mUnsubscribe 
  281.          Caption         =   "&Unsubscribe"
  282.       End
  283.    End
  284. Attribute VB_Name = "frmNews"
  285. Attribute VB_Creatable = False
  286. Attribute VB_Exposed = False
  287. Option Explicit
  288. Public CurrentNode As Node
  289. Public EVENTFLAG As Long
  290. Public PostName As String
  291. Public PostEmail As String
  292. Public AuthUser As String
  293. Public AuthPass As String
  294. '------------------------------------------------------------
  295. Private Sub Form_Load()
  296. '------------------------------------------------------------
  297.     Dim Path As String
  298. '------------------------------------------------------------
  299.     Path = App.Path
  300.     If (Left$(Path, 1) <> "\") Then Path = Path & "\"
  301.     FULLNEWSDB = Path & NEWSDB
  302.     EVENTFLAG = eventDONE
  303.     Call BuildDatabase(FULLNEWSDB, _
  304.                        sqlSCRIPT1, _
  305.                        sqlSCRIPT2, _
  306.                        sqlSCRIPT3, _
  307.                        sqlSCRIPT4)      ' If database does not exist then create it...
  308.     Set CurrentNode = Tree.Nodes.Add(, , NEWSGROUPROOT, NEWSGROUPROOT, icoGLOBE)
  309.     Call AddPersonalGroupsToTree(Tree, FULLNEWSDB)
  310. '------------------------------------------------------------
  311. End Sub
  312. '------------------------------------------------------------
  313. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  314.     If (nntpct.State = prcConnected) Then
  315.         nntpct.Quit
  316.     End If
  317.     End
  318. End Sub
  319. '------------------------------------------------------------
  320. Private Sub Form_Resize()
  321. '------------------------------------------------------------
  322.     Dim W As Long
  323.     Dim H As Long
  324. '------------------------------------------------------------
  325.     H = Abs(Me.ScaleHeight - Status.Height - Tools.Height)
  326.     Tree.Height = H
  327.     SizeBar.Height = H
  328.     W = Abs(Me.ScaleWidth - SizeBar.Left - SizeBar.Width)
  329.     lblNewsGroup.Width = W
  330.     ListMSG.Width = W
  331.     vSizeBar.Width = W
  332.     txtmsg.Move txtmsg.Left, txtmsg.Top, W, _
  333.                 Abs(Me.ScaleHeight - Status.Height - vSizeBar.Top - vSizeBar.Height)
  334. '------------------------------------------------------------
  335. End Sub
  336. '------------------------------------------------------------
  337. '------------------------------------------------------------
  338. Private Sub ListMSG_ItemClick(ByVal Item As ListItem)
  339. '------------------------------------------------------------
  340.     If Not (ListMSG.SelectedItem Is Nothing) Then
  341.         Screen.MousePointer = vbHourglass
  342.         txtmsg.Text = ""
  343.         EVENTFLAG = eventGETARTICLEBYNUM
  344.         Call nntpct.GetArticleByArticleNumber(ListMSG.SelectedItem.Text)
  345.        'Call nntpct.GetBodyByArticleNumber(ListMSG.SelectedItem.Text)
  346.        'Call nntpct.GetHeaderByArticleNumber(ListMSG.SelectedItem.Text)
  347.         Do While (EVENTFLAG = eventGETARTICLEBYNUM)
  348.             DoEvents
  349.         Loop
  350.         
  351.        Tools.Buttons(btnREPLYTOMSG).Enabled = nntpct.PostingAllowed
  352.        Screen.MousePointer = vbDefault
  353.     End If
  354. '------------------------------------------------------------
  355. End Sub
  356. '------------------------------------------------------------
  357. Private Sub mCancel_Click()
  358.     Call Tools_ButtonClick(Tools.Buttons(btnCANCEL))
  359. End Sub
  360. Private Sub mConnect_Click()
  361.     Call Tools_ButtonClick(Tools.Buttons(btnCONNECT))
  362. End Sub
  363. Private Sub mFile_Click()
  364.     mConnect.Enabled = (nntpct.State <> prcConnected)
  365.     mDisconnect.Enabled = (nntpct.State <> prcDisconnected)
  366.     mCancel.Enabled = (nntpct.State <> prcDisconnected)
  367. End Sub
  368. Private Sub mTools_Click()
  369.     mPost.Enabled = Tools.Buttons(btnPOSTMSG).Enabled
  370.     mReply.Enabled = Tools.Buttons(btnREPLYTOMSG).Enabled
  371.     mDecodeMsg.Enabled = (nntpct.State = prcConnected)
  372.     mDecodeMultMsg.Enabled = (nntpct.State = prcConnected)
  373. End Sub
  374. Private Sub mPost_Click()
  375.     Call Tools_ButtonClick(Tools.Buttons(btnPOSTMSG))
  376. End Sub
  377. Private Sub mReply_Click()
  378.     Call Tools_ButtonClick(Tools.Buttons(btnREPLYTOMSG))
  379. End Sub
  380. Private Sub mDecodeMsg_Click()
  381.     Call Tools_ButtonClick(Tools.Buttons(btnUUDECODE))
  382. End Sub
  383. Private Sub mDecodeMultMsg_Click()
  384. End Sub
  385. Private Sub mDisconnect_Click()
  386.     Call Tools_ButtonClick(Tools.Buttons(btnDISCONNECT))
  387. End Sub
  388. Private Sub mExit_Click()
  389.     Unload Me
  390. End Sub
  391. Private Sub mNewsGroup_Click()
  392.     mRefresh.Enabled = (nntpct.State = prcConnected)
  393.     mSubscribe.Enabled = (nntpct.State = prcConnected)
  394.     munsubscribe.Enabled = (nntpct.State = prcConnected)
  395. End Sub
  396. Private Sub mRefresh_Click()
  397.     Call Tools_ButtonClick(Tools.Buttons(btnLOADGROUPS))
  398. End Sub
  399. Private Sub mSubscribe_Click()
  400.     Call Tools_ButtonClick(Tools.Buttons(btnSEARCH))
  401. End Sub
  402. Private Sub mUnsubscribe_Click()
  403.     Call Tools_ButtonClick(Tools.Buttons(btnDELETE))
  404. End Sub
  405. Private Sub nntpct_AuthenticateRequest(UserID As String, Password As String)
  406.     UserID = AuthUser
  407.     Password = AuthPass
  408. End Sub
  409. Private Sub nntpct_Busy(ByVal isBusy As Boolean)
  410.     If Not isBusy Then
  411.         If (Status.Panels(2).Text <> nntpct.ReplyString) Then
  412.             Status.Panels(2).Text = nntpct.ReplyString
  413.         End If
  414.     End If
  415. End Sub
  416. '------------------------------------------------------------
  417. Private Sub nntpct_DocInput(ByVal DocInput As DocInput)
  418. '------------------------------------------------------------
  419.     Dim vData As Variant
  420. '------------------------------------------------------------
  421.     Debug.Print "DocInput: State", DocInput.State
  422.     Select Case DocInput.State
  423.     Case icDocBegin
  424.     Case icDocHeaders
  425.         Debug.Print "DocInput: Hdrs.Count", DocInput.Headers.Count
  426.     Case icDocData
  427.         Call DocInput.GetData(vData)
  428.         Debug.Print "DocInput:Data"
  429.         Debug.Print vData
  430.     End Select
  431. '------------------------------------------------------------
  432. End Sub
  433. '------------------------------------------------------------
  434. '------------------------------------------------------------
  435. Private Sub nntpct_DocOutput(ByVal DocOutput As DocOutput)
  436. '------------------------------------------------------------
  437.     Dim Data As String
  438.     Dim Length As Long
  439.     Static NewsData As String
  440. '------------------------------------------------------------
  441.     Debug.Print "DocOut: State", DocOutput.State
  442.     Debug.Print "DocOut:Bytes:" & CStr(DocOutput.BytesTransferred) & "/" & CStr(DocOutput.BytesTotal)
  443. '   Debug.Print "DocOut: Hdrs.Count", DocOutput.Headers.Count
  444.     Select Case DocOutput.State
  445.     Case icDocData
  446.         Call DocOutput.GetData(Data)
  447.         Length = Len(Data)
  448.     Case icDocHeaders
  449.         Dim x As DocHeader
  450.         For Each x In DocOutput.Headers
  451.             Debug.Print "DocOut:Header: " & x.Name, x.Value
  452.         Next
  453.     End Select
  454.     Select Case EVENTFLAG
  455.     Case eventERROR
  456.         Exit Sub
  457.     Case eventDONE
  458.         Debug.Print "DocOutput - eventDONE"
  459.     Case eventLISTGROUPDESC
  460.         Call AddGroupsToTree(Tree, Data)
  461.     Case eventLISTGROUPS
  462.         Call AddGroupsToDatabase(FULLNEWSDB, Data)
  463.     Case eventGETARTICLEHEADERS
  464.         Debug.Print "GetArticleHeaders:"
  465.     Case eventGETARTICLENUMBERS
  466.         Debug.Print "GetArticleNumbers:"
  467.     Case eventGETARTICLESUBJECT
  468.         Call AddHeaderToList(ListMSG, Data, EVENTFLAG)
  469.     Case eventGETARTICLEFROM
  470.         Call AddHeaderToList(ListMSG, Data, EVENTFLAG)
  471.     Case eventGETARTICLEBYNUM
  472.         Select Case DocOutput.State
  473.         Case icDocBegin
  474.             NewsData = ""
  475.         Case icDocData
  476.             NewsData = NewsData & Data
  477.         Case icDocEnd
  478.             txtmsg.Text = NewsData & Mid(Data, 1, Abs(Length - 3))
  479.         End Select
  480.     Case Else
  481.         Debug.Print "DocOutput - unhandled case"
  482.     End Select
  483.     Select Case DocOutput.State
  484.     Case icDocEnd, icDocError, icDocNone
  485.         EVENTFLAG = eventDONE
  486.     End Select
  487. '------------------------------------------------------------
  488. End Sub
  489. '------------------------------------------------------------
  490. Private Sub NNTPCT_Error(Number As Integer, Description As String, Scode As Long, Source As String, HelpFile As String, HelpContext As Long, CancelDisplay As Boolean)
  491.     CancelDisplay = False
  492.     EVENTFLAG = eventERROR
  493. End Sub
  494. Private Sub NNTPCT_lastArticle(ByVal articleNumber As Long, ByVal messageID As String)
  495.     Debug.Print "lastArticle", articleNumber, messageID
  496. End Sub
  497. Private Sub NNTPCT_NextArticle(ByVal articleNumber As Long, ByVal messageID As String)
  498.     Debug.Print "NextArticle", articleNumber, messageID
  499. End Sub
  500. Private Sub NNTPCT_ProtocolStateChanged(ByVal ProtocolState As Integer)
  501.     Debug.Print "ProtocolStateChanged", ProtocolState
  502. End Sub
  503. '------------------------------------------------------------
  504. Private Sub NNTPCT_SelectGroup(ByVal groupName As String, ByVal firstMessage As Long, ByVal lastMessage As Long, ByVal msgCount As Long)
  505. '------------------------------------------------------------
  506.     Dim msg As Long
  507.     Dim sMsg As String
  508. '------------------------------------------------------------
  509.     Screen.MousePointer = vbHourglass
  510.     Call SendMessage(ListMSG.hwnd, WM_SETREDRAW, REDRAWOFF, 0) ' Turn Paint Off
  511.     EVENTFLAG = eventGETARTICLESUBJECT
  512.     Call nntpct.GetArticleHeaders("Subject", Trim$(Str$(firstMessage)), Trim$(Str$(lastMessage)))
  513.     Do While (EVENTFLAG = eventGETARTICLESUBJECT)
  514.         DoEvents
  515.     Loop
  516.     EVENTFLAG = eventGETARTICLEFROM
  517.     Call nntpct.GetArticleHeaders("From", Trim$(Str$(firstMessage)), Trim$(Str$(lastMessage)))
  518.     Do While (EVENTFLAG = eventGETARTICLEFROM)
  519.         DoEvents
  520.     Loop
  521.     Call SendMessage(ListMSG.hwnd, WM_SETREDRAW, REDRAWON, 0)  ' Turn Paint On
  522.     Screen.MousePointer = vbDefault
  523. '------------------------------------------------------------
  524. End Sub
  525. '------------------------------------------------------------
  526. Private Sub NNTPCT_StatArticle(ByVal articleNumber As Long, ByVal messageID As String)
  527.     Debug.Print "StatArticle", articleNumber, messageID
  528. End Sub
  529. '------------------------------------------------------------
  530. Private Sub NNTPCT_StateChanged(ByVal State As Integer)
  531. '------------------------------------------------------------
  532.     Dim btnEnabled As Boolean
  533. '------------------------------------------------------------
  534.     btnEnabled = (nntpct.State = prcConnected)
  535.     Status.Panels(1).Text = nntpct.StateString
  536.     Tree.Enabled = btnEnabled
  537.     Tools.Buttons(btnLOADGROUPS).Enabled = btnEnabled
  538.     Tools.Buttons(btnCONNECT).Enabled = Not btnEnabled
  539.     Tools.Buttons(btnDISCONNECT).Enabled = (nntpct.State <> prcDisconnected)
  540.     Tools.Buttons(btnCANCEL).Enabled = (nntpct.State <> prcDisconnected)
  541.     Tools.Buttons(btnPOSTMSG).Enabled = btnEnabled And nntpct.PostingAllowed
  542.     Tools.Buttons(btnREPLYTOMSG).Enabled = btnEnabled And nntpct.PostingAllowed
  543.     Tools.Buttons(btnUUDECODE).Enabled = btnEnabled
  544.     Tools.Buttons(btnLOADGROUPS).Enabled = btnEnabled
  545.     Tools.Buttons(btnSEARCH).Enabled = btnEnabled
  546.     Tools.Buttons(btnDELETE).Enabled = btnEnabled
  547.     Debug.Print "State", nntpct.StateString, nntpct.State
  548. '------------------------------------------------------------
  549. End Sub
  550. '------------------------------------------------------------
  551. Private Sub nntpct_Timeout(ByVal event As Integer, Continue As Boolean)
  552.     Dim msg As String
  553.     Dim rc As Long
  554.     Select Case event
  555.     Case prcConnectTimeout
  556.         msg = "A connection timeout has occured.  Do you wish to continue?"
  557.     Case prcReceiveTimeout
  558.         msg = "A receive timeout has occured.  Do you wish to continue?"
  559.     Case prcUserTimeout
  560.         msg = "A timeout has occured.  Do you wish to continue?"
  561.     End Select
  562.     rc = MsgBox(msg, vbYesNo)
  563.     Continue = (rc = vbYes)
  564. End Sub
  565. '------------------------------------------------------------
  566. Private Sub NRStatus_Timer()
  567. '------------------------------------------------------------
  568.     If Status.Panels(2).Text <> (nntpct.ReplyString) Then
  569.         Status.Panels(2).Text = nntpct.ReplyString
  570.     End If
  571. '------------------------------------------------------------
  572. End Sub
  573. '------------------------------------------------------------
  574. '------------------------------------------------------------
  575. Private Sub SizeBar_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  576. '------------------------------------------------------------
  577.     If (Button = vbLeftButton) Then                 ' If Left Button Down
  578.         SizeBar.Left = SizeBar.Left + x             ' Move Size Bar
  579.         Me.Refresh                                  ' Refresh improves appearence
  580.     End If
  581. '------------------------------------------------------------
  582. End Sub
  583. '------------------------------------------------------------
  584. '------------------------------------------------------------
  585. Private Sub SizeBar_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  586. '------------------------------------------------------------
  587.     Dim L As Long, W As Long, SW As Long
  588.     Dim L2 As Long, W2 As Long
  589. '------------------------------------------------------------
  590.     With SizeBar
  591.         L = .Left
  592.         W = .Width
  593.         SW = Me.ScaleWidth
  594.         
  595.         If (L < W) Then                             ' Outside Left Of Window
  596.             L = W                                   ' Fix Position
  597.             .Left = L                               ' Adjust sizebar position
  598.         ElseIf (L > SW) Then                        ' Outside Right Of Window
  599.             L = SW - W                              ' Fix Position
  600.             .Left = L                               ' Adjust sizebar position
  601.         End If
  602.         
  603.         Tree.Width = Abs(L - Tree.Left)             ' Resize TreeView Width
  604.         L2 = L + W
  605.         W2 = Abs(SW - L - W)
  606.         
  607.         lblNewsGroup.Move L2, lblNewsGroup.Top, W2  ' Resize newsgroup label
  608.         ListMSG.Move L2, ListMSG.Top, W2            ' Resize msg listview
  609.         vSizeBar.Move L2, vSizeBar.Top, W2          ' Resize verticle sizebar
  610.         txtmsg.Move L2, txtmsg.Top, W2              ' Resize msg textbox
  611.     End With
  612. '------------------------------------------------------------
  613. End Sub
  614. '------------------------------------------------------------
  615. '------------------------------------------------------------
  616. Private Sub vSizeBar_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  617. '------------------------------------------------------------
  618.     If (Button = vbLeftButton) Then                 ' If Left Button Down
  619.         vSizeBar.Top = vSizeBar.Top + Y             ' Move Size Bar
  620.         Me.Refresh                                  ' Refresh improves appearence
  621.     End If
  622. '------------------------------------------------------------
  623. End Sub
  624. '------------------------------------------------------------
  625. '------------------------------------------------------------
  626. Private Sub vSizeBar_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  627. '------------------------------------------------------------
  628.     Dim T As Long, H As Long, lblH As Long
  629.     Dim TRange As Long, BRange As Long
  630. '------------------------------------------------------------
  631.     T = vSizeBar.Top
  632.     H = vSizeBar.Height
  633.     lblH = lblNewsGroup.Height
  634.     TRange = lblNewsGroup.Top + (2 * lblH) + H
  635.     BRange = Abs(Status.Top - lblH - H)
  636.     If (T < TRange) Then            ' Is sizebar higher than label
  637.         T = TRange + H              ' Adjust position
  638.         vSizeBar.Top = T
  639.     ElseIf (T > BRange) Then        ' Is sizebar lower than status bar
  640.         T = BRange - H              ' Fix Position
  641.         vSizeBar.Top = T
  642.     End If
  643.     ListMSG.Height = Abs(T - ListMSG.Top)
  644.     txtmsg.Move txtmsg.Left, T + H, txtmsg.Width, Abs(Status.Top - T - H)
  645. '------------------------------------------------------------
  646. End Sub
  647. '------------------------------------------------------------
  648. '------------------------------------------------------------
  649. Private Sub Tools_ButtonClick(ByVal Button As Button)
  650. '------------------------------------------------------------
  651.     '------------------------------------------------------------
  652.     Select Case Button.Index
  653.     '------------------------------------------------------------
  654.     Case btnCONNECT
  655.     '------------------------------------------------------------
  656.         Call ConnectToNewsServer(nntpct, PostName, PostEmail, AuthUser, AuthPass)
  657.     '------------------------------------------------------------
  658.     Case btnDISCONNECT
  659.     '------------------------------------------------------------
  660.         On Error Resume Next ''' needed for bug...
  661.         If (nntpct.State <> prcDisconnected) Then nntpct.Quit
  662.     '------------------------------------------------------------
  663.     Case btnCANCEL
  664.     '------------------------------------------------------------
  665.         nntpct.Cancel
  666.     '------------------------------------------------------------
  667.     Case btnPOSTMSG
  668.     '------------------------------------------------------------
  669.         Call PostMessage(nntpct, PostName, PostEmail, "", "", "")
  670.     '------------------------------------------------------------
  671.     Case btnREPLYTOMSG
  672.     '------------------------------------------------------------
  673.         Call PostMessage(nntpct, PostName, PostEmail, _
  674.                          lblNewsGroup.Caption, _
  675.                          ListMSG.SelectedItem.SubItems(siSubject), _
  676.                          txtmsg.Text)
  677.     '------------------------------------------------------------
  678.     Case btnUUDECODE
  679.     '------------------------------------------------------------
  680.         Call DecodeMSG(txtmsg.Text, ComDLG)
  681.     '------------------------------------------------------------
  682.     Case btnLOADGROUPS
  683.     '------------------------------------------------------------
  684.         Dim DB As Database
  685.         Set DB = OpenDatabase(FULLNEWSDB)               ' Open connection to database
  686.         DB.Execute "delete * from Groups;"
  687.         DB.Close
  688.         Set DB = Nothing
  689.         
  690.         EVENTFLAG = eventLISTGROUPS
  691.         nntpct.ListGroups
  692.     '------------------------------------------------------------
  693.     Case btnDELETE
  694.     '------------------------------------------------------------
  695.         Call DeleteGroups(Tree, FULLNEWSDB)
  696.     '------------------------------------------------------------
  697.     Case btnSEARCH
  698.     '------------------------------------------------------------
  699.         Load frmNewsSearch
  700.         frmNewsSearch.Show vbModal
  701.     '------------------------------------------------------------
  702.     End Select
  703. '------------------------------------------------------------
  704. End Sub
  705. '------------------------------------------------------------
  706. '------------------------------------------------------------
  707. Private Sub Tree_NodeClick(ByVal Node As Node)
  708. '------------------------------------------------------------
  709.     Tools.Buttons(btnREPLYTOMSG).Enabled = False    ' Disable toolbar button
  710.     Tools.Buttons(btnDELETE).Enabled = (Node.Key <> NEWSGROUPROOT)
  711.     If (Node.Image = icoNEWS) And (Node.Key <> CurrentNode.Key) Then
  712.         ListMSG.ListItems.Clear                 ' Clear list of news group message headers
  713.         txtmsg.Text = ""                        ' Clear news group message
  714.         Set CurrentNode = Node                  ' Save current node
  715.         lblNewsGroup.Caption = Node.Key
  716.         Call nntpct.SelectGroup(Node.Key)       ' Select current group
  717.     End If
  718. '------------------------------------------------------------
  719. End Sub
  720. '------------------------------------------------------------
  721.